/*
 * @brief:
 * @Author: TzzzT
 * @Date: 2022-05-08 11:33:00
 * @LastEditTime: 2023-04-06 21:10:32
 * @LastEditors: TzzzT
 */
#pragma once

#ifdef __cplusplus
extern "C"
{
#endif
    typedef struct display_s
    {
        // wait
        int8_t batt[5]; // 最后一个是最小值。
        uint32_t dev_id;
        bool low_batt;
        // game
        uint8_t conn_dev_num;
        char hint[7];
        uint16_t bullet_num;
        uint8_t attack;
        uint8_t teamroom;
        uint16_t HP;
        uint8_t kill;
        uint8_t death;
        uint8_t score;
    } display_t;

    typedef enum page_class_e
    {
        SCR_START_PAGE,
        SCR_DISCONNET_PAGE,
        SCR_WAITING_PAGE,
        SCR_LIVING_PAGE,
    } page_class_t;

#define FRESH_BASE 10
#define MS_COUNT(x) (x / FRESH_BASE)

    esp_err_t scr_init(void);
    void goto_new_page(uint8_t *scr_page);
    bool start_page_ui(uint16_t *count, uint8_t *scr_page);
    void wait_game_start_page_ui(uint16_t *count, uint8_t *scr_page);
    void game_living_page_ui(uint16_t *count, uint8_t *scr_page);
    void disconnect_page_ui(uint16_t *count, uint8_t *scr_page);

#ifdef __cplusplus
}
#endif